Skip to content

Handle structural types with curried methods #5391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 8, 2018

Conversation

allanrenucci
Copy link
Contributor

We desugar x.foo(a1)(a2) (where the type of x is a structural type) to:

(x:selectable).applyDynamic("a", CTa1, CTa2)(a1, a2)

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we do not want this. It prevents the use case where a selectDynamic returns a function value that is then applied.

- We desugar `x.foo(a1)(a2)` (where the type of `x` is a structural type)
  to:

  ```scala
  (x:selectable).applyDynamic("a", CTa1, CTa2)(a1, a2)
  ```

- Add test cases for implicit and dependant methods

- Rejects all dependant methods used in structural type. They are pretty
  broken currently. Should be fixable
@allanrenucci
Copy link
Contributor Author

I believe we do not want this. It prevents the use case where a selectDynamic returns a function value that is then applied.

No, I made sure this use case still works. I have added test cases:
https://github.com/lampepfl/dotty/blob/59c90d1c5c77400e3882c2b6fae9a87bcd3df7f3/tests/run/structural.scala#L49
https://github.com/lampepfl/dotty/blob/59c90d1c5c77400e3882c2b6fae9a87bcd3df7f3/tests/run/structural.scala#L52-L53

@odersky
Copy link
Contributor

odersky commented Nov 8, 2018

OK, convinced now that the use case still works.

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we do not want this. It prevents the use case where a selectDynamic returns a function value that is then applied.

@allanrenucci allanrenucci merged commit 2d407aa into scala:master Nov 8, 2018
@allanrenucci allanrenucci deleted the struct-types branch November 8, 2018 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants